package meihua.stopcarapp.model;

import meihua.mylibrary.basebean.ResultModel;
import meihua.mylibrary.baserx.RxSchedulers;
import meihua.stopcarapp.api.Api;
import meihua.stopcarapp.api.URLType;
import meihua.stopcarapp.presenter.contract.StopCarContract;
import rx.Observable;
import rx.functions.Func1;

/**
 * Name: LGZ
 * Time: 2017/5/19.
 * Dec:
 */

public class StopCarModel implements StopCarContract.Model {

    @Override
    public Observable<String> getCharging(String order_num, String parking_list_num) {
        return Api.getDefault(URLType.STOPCAR_URL)
                .getCharging(order_num, parking_list_num)
                .map(new Func1<ResultModel<String>, String>() {
                    @Override
                    public String call(ResultModel<String> resultModel) {
                        return resultModel.getData();
                    }
                })
                .compose(RxSchedulers.<String>io_main());
    }
}
